#include "ChatServer.hpp"
#include "ChatService.hpp"
#include <signal.h>

const std::string ip = "127.0.0.1";
const uint16_t port = 8888;
const std::string ServerName = "ChatServer";


void ResetHanlder(int signal)
{
     //调用 resetState函数将所有online的人强制下线
     ChatService::instance()->reset();
     exit(0);
}

int main()
{
    
    signal(SIGINT,ResetHanlder);

    muduo::net::EventLoop loop;
    muduo::net::InetAddress ipPort(ip,port);
    ChatServer cs(&loop,ipPort,ServerName);

    cs.start();
    loop.loop();

    return 0;
}